import Vue from 'vue'

import 'normalize.css/normalize.css' // a modern alternative to CSS resets

import Element from 'element-ui'
import './styles/element-variables.scss'
import uploader from 'vue-simple-uploader'

import EnhancedTable from 'glp-alpha-components/src/Business/EnhancedTable'
import SearchForm from 'glp-alpha-components/src/Business/SearchForm'
import GoodsRankList from './components/GoodsRankList/index'

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import i18n from './lang' // internationalization
import './icons' // icon
import './permission' // permission control
import './utils/error-log' // error log

import * as filters from './filters' // global filters
import qrcode from 'vue-qrcode-directive'

// 注册全局组件
Vue.component('enhanced-table', EnhancedTable)
Vue.component('search-form', SearchForm)
Vue.component('goods-rank-list', GoodsRankList)

Vue.use(qrcode)
Vue.use(uploader)

Vue.use(Element, {
  size: 'medium', // set element-ui default size
  i18n: (key, value) => i18n.t(key, value)
})

// register global utility filters
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})
